package com.jz.pay3.design.command;

public class Client {
    public static void main(String[] args) {
        // 接收者
        Receiver light = new Light("灯");
        // 相关命令
        Command turnON = new LightOnCommand("turn on",light);
        // 相关命令
        Command turnOFF = new LightOffCommand("turn off",light);

        CommandController commandController = new CommandController();
        commandController.addCommand(turnON);
        commandController.addCommand(turnOFF);

        commandController.sendCmd(turnON);
        commandController.sendCmd(turnOFF);
        System.out.println("=========");
        commandController.sendCmd("turn off");
        commandController.sendCmd("turn on");

        System.out.println("=========");
        commandController.sendBatchCmd();

        System.out.println("=========");
        commandController.removeCommand(turnON);
        commandController.sendBatchCmd();

        System.out.println("=========");
        commandController.removeCommand(turnOFF);
        commandController.sendBatchCmd();
    }
}
